<template>
	<view class="box">
		<page-head :transparent='false'><slot slot="title">{{title.length>10?title.substr(0,10)+'...':title}}</slot></page-head>
		<view>
			<view class="img"><img class="img_b" :src="tgBanner627" /></view>
			<view class="img_link">
				<view class="img_box" v-for="(data, index2) in imgUrl" :key="index2">
					<img class="img_x" :src="data.img" @click="linkTo(data.imgurl,index2)" />
				</view>
			</view>
		</view>
	</view>
</template>

<script>
// import CountDown from '../../../components/countdown.vue';
import tgBanner627 from '../../../static/img/ppz/tgBanner627.png'
import tg6271 from '../../../static/img/ppz/tg627-1.png'
import tg6272 from '../../../static/img/ppz/tg627-2.png'
import tg6273 from '../../../static/img/ppz/tg627-3.png'
import tg6274 from '../../../static/img/ppz/tg627-4.png'
import tg6275 from '../../../static/img/ppz/tg627-5.png'
import tg6276 from '../../../static/img/ppz/tg627-6.png'
import tg6277 from '../../../static/img/ppz/tg627-7.png'
import tg6278 from '../../../static/img/ppz/tg627-8.png'
import tg6279 from '../../../static/img/ppz/tg627-9.png'
import tg62710 from '../../../static/img/ppz/tg627-10.png'
export default {
	onShow() {		
	   this.ti = '超级品牌周';
	   genCommonData();
	},
	data() {
		return {
			timestamp: 0,
			imgUrl: [],
			imgUrl2: [],
			imgList: [
				tg6271,
				tg6272,
				tg6273,
				tg6274,
				tg6275,
				tg6276,
				tg6277,
				tg6278,
				tg6279,
				tg62710
			],
			ms: 'may-fifthT',
			title: '超级品牌周',
			tgBanner627: tgBanner627,
			ms2: 'may-bk',
			httpUrl: '../../selfdetail/selfdetail?',
			url: [
				'../../selfdetail/selfdetail?skuId=7771&cid=395&title=爱丁堡真空保温两件套&seller=好品购',
				'../../selfdetail/selfdetail?skuId=2787&cid=391&title=枝发不锈钢保鲜盒三件套&seller=京东自营',
				'../../selfdetail/selfdetail?skuId=3124&cid=332&title=长虹养生壶食品接触用304不锈钢 高硼硅玻璃&seller=京东自营',
				'../../selfdetail/selfdetail?skuId=2861&cid=303&title=时尚户外运动休闲中性双肩包&seller=京东自营',
				'../../selfdetail/selfdetail?skuId=7769&cid=391&title=鸿运连年三件套&seller=好品购',
				'../../selfdetail/selfdetail?skuId=7768&cid=563&title=迷你多功能电煮锅&seller=好品购',
				'../../selfdetail/selfdetail?skuId=2856&cid=391&title=欧锐铂璀璨之星厨具两件24cm+32cm&seller=京东自营',
				'../../selfdetail/selfdetail?skuId=2864&cid=391&title=枝发 不锈钢蒸锅 复底加厚 电磁炉煤气炉通用锅 28cm&seller=京东自营',
				'../../selfdetail/selfdetail?skuId=7767&cid=391&title=和美e家涮烤一体电火锅 &seller=好品购',
				'../../selfdetail/selfdetail?skuId=7770&cid=391&title=施尔宁不锈钢炒锅&seller=好品购'
			]
		};
	},
	onLoad(event) {
		if (event.token != '' && event.token != 'null' && event.token != null && event.token != undefined && event.token !=
		    'undefined') {
		    uni.setStorageSync('token', decodeURI(event.token));
		}
		this.time();
	},
	methods: {
		linkTo(url,index) {
			if (url != '') {
				console.log('index===' + (parseInt(index) + parseInt(1)));
				onEvent('page_home_top_banner2_goods' + (parseInt(index) + parseInt(1)));
				setTimeout(function() {
					if (url !== '') {
						h5NavigateTo({
							url: url
						});
					}
				}, 1000);
			}
		},
		now() {
			return Date.now();
		},
		countDownEnd() {
			console.log('倒计时结束');
			uni.showModal({
				title: '',
				content: '秒杀结束',
				showCancel: false
			});
			this.imgUrl = [];
			this.url = [];
			this.time();
		},
		time() {
			let obj = {
				lastTime: new Date('2019/7/1 09:59:59').getTime(),
				nowTime: new Date().getTime()
			};
			this.timestamp = obj.lastTime - obj.nowTime;
			this.dataTime();
		},
		dataTime() {			
			this.getImgDate();
		},
		getImgDate() {
			this.url.map((item, index) => {
				this.imgUrl.push({
					img: this.imgList[index],
					imgurl: item
				});
			});
			// this.url2.map((item, index) => {
			// 	this.imgUrl2.push({
			// 		img: `../../../static/img/miaosha/fqj${index + 1}.png`,
			// 		imgurl: item
			// 	});
			// });
		}
	}
	// components: {
	// 	CountDown
	// }
};
</script>

<style lang="scss" scoped>
.box {
	width: 100%;
	background: #f9e0f3;
	margin: 0;
	padding: 0;
	font-size: 0;
	.img {
		width: 100%;
		.img_b {
			display: block;
			width: 100%;
			margin: 0;
			padding: 0;
		}
	}

	.setInterval {
		width: 100%;
		height: 104px;
		color: #fff;
		font-size: 16px;
		/* line-height: 1.8; */
		text-align: center;
		// height: 146px;

		.set_box {
			width: 100%;
			height: 100%;
			/* margin: 48px auto; */
			/* width: 380px;
			height: 120px; */
			/* border: 6px solid #fff;
			border-radius: 10px; */
		}
	}

	.img_link {
		margin-top: 15px;
		width: 100%;
		display: flex;
		flex-wrap: wrap;
		justify-content: center;
		background-color: #f9e0f3;
		.img_logo {
			width: 100%;
			// margin: 0 auto;

			.img_x {
				width: 100%;
			}
		}
		.img_box1 {
			width: 100%;

			.img_x {
				width: 100%;
			}
		}

		.img_box {
			width: 100%;
			.img_x {
				width: 100%;
			}
		}
	}
}
</style>
